package aTest;

/**
 * @Author zhang lei
 * @Date 2022-01-10 14:06
 */
public class Test {

    public static final double  start = 5670;

//    public static final double  gap = 5.01;

    public static final double rate = 0.03/12;

    /**
     * 计算下房贷
     * @param args
     */
    public static void main(String[] args) {
        //每月本金增加5.01元， 360月
        computeAny();

        compute100();
    }

    private static void compute100() {
        System.out.println( 100 * 10000 * Math.pow(1 + 0.04, 30));
    }

    private static void computeAny() {
        Double all = 0.0;
        Double cur = 0.0;
        for (int i = 0; i < 360; i++) {
            Double ben = cur + 5670;
            cur = ben * (1+rate);
            all = all + cur;
            System.out.println("第 "+(i+1) + " 期，本金 "+ ben +"本息" + all );
        }
    }
}
